const { ApolloServer, gql } = require('apollo-server')


// 可以安装 Apollo GraphQL 插件用于语法高亮
const typeDefs = gql`
    type User {
        name: String
        age: Int
    }
    type Query {
        user:User
    }
`

const user = {
    name: '小明',
    age: 13
}

const resolvers = {
    // 所有 query 入口
    Query: {
        user: () => user
    }
}

const server = new ApolloServer({ typeDefs, resolvers });

server.listen().then(({ url }) => {
    console.log(`🚀  Server ready at ${url}`);
});